package com.example.fw;

import javax.swing.tree.TreePath;

import org.netbeans.jemmy.operators.JTreeOperator;

public class TreeHelper extends HelpersBase{
	
	public TreeHelper(ApplicationManager applicationManager) {
		super(applicationManager);
	}
	
	
	public String clickTreeItem(String folder) {
		JTreeOperator tree = new JTreeOperator(mainFrame);
		int rowCount = tree.getRowCount();
		for(int i = 0; i < rowCount;i++){
			TreePath pathForRow = tree.getPathForRow(i);
			String stringPath = pathForRow.getLastPathComponent().toString();
			if (folder.equals(stringPath)){
				tree.clickOnPath(pathForRow);
				return folder;
			}	
		}
		return null;
	}

}
